#include <stdio.h>
#include<stdlib.h>
#include<stdbool.h>
typedef int  BTDataType;
typedef struct BinaryTreeNode//申请节点
{
    BTDataType val;
    struct BinaryTreeNode*left;
    struct BinaryTreeNode*right;
}BTNode;
BTNode* BuyNode(BTDataType x)
{
    BTNode *newnode=(BTNode*)malloc(sizeof(BTNode));
    newnode->val=x;
    newnode->right=NULL;
    newnode->left=NULL;
    return  newnode;
}


BTNode* CreatBinaryTree()//链接节点
{
    BTNode*node1= BuyNode(1);
    BTNode*node2=BuyNode(1);
    BTNode*node3=BuyNode(1);
    BTNode* node4 = BuyNode(1);
    BTNode* node5 = BuyNode(1);
    BTNode* node6 = BuyNode(1);
    node1->left = node2;

    node4->left = node5;
    node4->right = node6;
    return node1;
}

bool isUnivalTree(BTNode* root)
{
    if(root==NULL)
    {
        return true;
    }

    if(root->left!=NULL&&root->val!=root->left->val)
    {
        return false;
    }
    if(root->right!=NULL&&root->val!=root->right->val)
    {
        return false;
    }

    return isUnivalTree(root->left)&&isUnivalTree(root->right);
}
int main() {
    BTNode* ret=CreatBinaryTree();
    if(isUnivalTree(ret))
    {
        printf("same");
    }

    return 0;
}
